package com.hw.springcloud.controller;

import com.hw.springcloud.entities.CommonResult;
import com.hw.springcloud.entities.Payment;
import com.hw.springcloud.service.PaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Classname: PaymentController
 * @Description: 描述
 * @Date: 2021/12/16
 * @Author: HuWei
 */
@RestController
@RequestMapping("/payment")
public class PaymentController {

    @Autowired
    private PaymentService paymentService;

    @Value("${server.port}")
    private String serverPort;


    @GetMapping("/getById/{id}")
    public CommonResult<Payment> getById(@PathVariable("id")Long id){
        Payment byId = paymentService.getById(id);
        return new CommonResult<>(200, "端口:" + serverPort, byId);
    }
}
